﻿# CMakeList.txt: 顶层 CMake 项目文件，在此处执行全局配置并包含子项目。
CMAKE_MINIMUM_REQUIRED(VERSION 3.31.6 FATAL_ERROR)
PROJECT("NahidaProject")

SET(CMAKE_CXX_STANDARD 20)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)

OPTION(BUILD_THIRDPARTY "Specific build thrid-party module" OFF)
OPTION(BUILD_COMMUNICATION "Specific build communication module" ON)
OPTION(BUILD_CONSOLE "Specific build console module" ON)
OPTION(BUILD_DATABASE "Specific build database module" ON)
OPTION(BUILD_GENERIC "Specific build generic module" ON)
OPTION(BUILD_HASHALGORITHM "Specific build hash algorithm" ON)
OPTION(BUILD_MATHEMATICS "Specific mathematics module" ON)
OPTION(BUILD_OTHER "Specific build other module" ON)
OPTION(BUILD_SERIALIZATION "Specific build serialization module" ON)
OPTION(BUILD_THREAD "Specific build thread module" ON)
OPTION(BUILD_UNITTEST "Specific build unit test module" ON)

IF(NOT WIN32)
	MESSAGE(FATAL_ERROR "Can't build it on the other OS.")
ENDIF()

# 如果条件允许，请为 MSVC 编译器启用热重载。
IF(POLICY CMP0141)
	CMAKE_POLICY(SET CMP0141 NEW)
	SET(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
ENDIF()

# 有条件地包含子项目。

IF(FALSE)
	ADD_SUBDIRECTORY("NahidaProject.ThirdParty")
ENDIF()
IF(${BUILD_COMMUNICATION})
	ADD_SUBDIRECTORY("NahidaProject.Communication")
ENDIF()
IF(${BUILD_CONSOLE})
	ADD_SUBDIRECTORY("NahidaProject.Console")
ENDIF()
IF(${BUILD_DATABASE})
	ADD_SUBDIRECTORY("NahidaProject.Database")
ENDIF()
IF(${BUILD_GENERIC})
	ADD_SUBDIRECTORY("NahidaProject.Generic")
ENDIF()
IF(${BUILD_HASHALGORITHM})
	ADD_SUBDIRECTORY("NahidaProject.HashAlgorithm")
ENDIF()
IF(${BUILD_MATHEMATICS})
	ADD_SUBDIRECTORY("NahidaProject.Mathematics")
ENDIF()
IF(${BUILD_OTHER})
	ADD_SUBDIRECTORY("NahidaProject.Other")
ENDIF()
IF(${BUILD_SERIALIZATION})
	ADD_SUBDIRECTORY("NahidaProject.Serialization")
ENDIF()
IF(${BUILD_THREAD})
	ADD_SUBDIRECTORY("NahidaProject.Thread")
ENDIF()
IF(${BUILD_UNITTEST})
	ADD_SUBDIRECTORY("NahidaProject.UnitTest")
ENDIF()
